package tbdp.tool.container;

import java.util.Collections;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

import tbdp.tool.spi.Processor;

/**
 * @author xbkaishui
 * @version $Id: ProcessorContainer.java, v 0.1 2017-06-17 下午4:18 xbkaishui Exp $$
 */
public class ProcessorContainer {

    public static Map<String, Processor> processorContainer = new ConcurrentHashMap<String, Processor>();

    public static void addProcessor(Processor processor) {
        processorContainer.putIfAbsent(processor.getType(), processor);
    }

    public static Processor getProcessor(String type) {
        return processorContainer.get(type);
    }

    public static Map<String, Processor> getProcessorContainer() {
        return Collections.unmodifiableMap(processorContainer);
    }
}
